import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_eve_plugin/components/ye_xiu/checkpoint/checkpoint_succ_center_grid.dart';
import 'package:flutter_eve_plugin/components/ye_xiu/checkpoint/checkpoint_succ_footer.dart';
import 'package:flutter_eve_plugin/components/ye_xiu/checkpoint/checkpoint_succ_top.dart';
import 'package:flutter_eve_plugin/store/main.dart';
import 'package:flutter_eve_plugin/store_vm/app_vm.dart';
import 'package:flutter_eve_plugin/utils/image_util.dart';
import 'package:flutter_redux/flutter_redux.dart';

class CheckpointSuccPage extends StatefulWidget {
  final String title;
  CheckpointSuccPage({Key key, this.title}) : super(key: key);

  _CheckpointSuccPageState createState() => _CheckpointSuccPageState();
}

class _CheckpointSuccPageState extends State<CheckpointSuccPage> {
  @override
  Widget build(BuildContext context) {
    return StoreConnector<AppState, AppStateViewModel>(
        onInit: (store){
        },
        converter: (store) {
      return AppStateViewModel(state: store.state);
    }, builder: (context, vm) {
      var fightSucc = vm.state.yeXiuState.checkpointState.fightSucc;
      var stageInfo = vm.state.yeXiuState.checkpointState.checkpointStageInfo;
      return Container(
        decoration: BoxDecoration(
            image: DecorationImage(
                image: AssetImage(
                    imageUtilYeXiu('checkpoint/icon_checkpoint_bg@3x')),
                fit: BoxFit.fitWidth,
                alignment: Alignment.topCenter)),
        child: SafeArea(
          child: SingleChildScrollView(
            child: Stack(
              children: <Widget>[
                CheckpointSuccTopWidget(
                    info: fightSucc,
                    boss: stageInfo?.stageBasics?.configInfo?.bossname ?? ''),
                CheckpointSuccCenterWidget(info: fightSucc),
                CheckpointSuccFooterWidget(
                  info: fightSucc,
                  stageId: stageInfo?.stageBasics?.configInfo?.stageId ?? '',
                )
              ],
            ),
          ),
        ),
      );
    });
  }
}
